package com.tbit.uqbike.object.pojo;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @Author: chen
 * @Description: 回收记录表
 * @Date: 创建于 15:16 2023/2/9
 */
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@TableName("recoverylog")
@Accessors(chain = true)
public class RecoveryLog {
    /**
     * 主键id
     */
    private Integer recoveryId;
    /**
     * 区域ID
     */
    private Integer accountId;
    /**
     * 区域名称
     */
    @TableField(exist = false)
    @Csv(name = "运营区域")
    @Excel(name = "运营区域", sort = 1)
    private String accountName;
    /**
     * 设备ID
     */
    private Integer machineId;
    /**
     * 车辆编号
     */
    @Csv(name = "车辆编号")
    @Excel(name = "车辆编号", sort = 2)
    private String userCode;
    /**
     * 中控编号
     */
    @Csv(name = "设备编号")
    @Excel(name = "设备编号", sort = 3)
    private String machineNO;
    /**
     * 开始经度
     */
    private Double startLo;
    /**
     * 开始纬度
     */
    private Double startLa;

    /**
     * 结束经度
     */
    private Double endLo;
    /**
     * 结束纬度
     */
    private Double endLa;
    /**
     * 回收人id
     */
    private Integer recoveryUserId;
    /**
     * 开始时间
     */
    @Csv(name = "回收开始时间")
    @Excel(name = "回收开始时间", sort = 4, dateFormat = "yyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date startTime;

    /**
     * 结束时间
     */
    @Csv(name = "回收结束时间")
    @Excel(name = "回收结束时间", sort = 5, dateFormat = "yyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date endTime;

    /**
     * 回收人名称
     */
    @Csv(name = "回收人名称")
    @Excel(name = "回收人名称", sort = 6)
    private String recoveryUserName;
    /**
     * 入库人ID
     */
    private Integer stockUserId;

    /**'入库时间'**/
    @Csv(name = "入库时间")
    @Excel(name = "入库时间", sort = 7, dateFormat = "yyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date stockTime;

    /**
     * 入库人名称
     */
    @Csv(name = "入库人名称")
    @Excel(name = "入库人名称", sort = 8)
    private String stockUserName;

    /**'出库时间'**/
    @Csv(name = "出库时间")
    @Excel(name = "出库时间", sort = 9, dateFormat = "yyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date outStockTime;

    /**'出库人名称'**/
    @Csv(name = "出库人名称")
    @Excel(name = "出库人名称", sort = 10)
    private String outStockUserName;

    /**'库房名称'**/
    @Csv(name = "仓库名称")
    @Excel(name = "仓库名称", sort = 11)
    private String stockName;

    /**
     * 状态
     */
    @Csv(name = "状态", keys = {"0", "1","2"}, values = {"回收中", "已入库","已出库"})
    @Excel(name = "状态", sort = 12, readConverterExp = "0=回收中,1=已入库,2=已出库")
    private Integer state;
    /**
     * 备注
     */
    @Csv(name = "备注")
    @Excel(name = "备注", sort = 13)
    private String remark;

    /**'库房id'**/
    private Integer stockId;

    /**'出库人id'**/
    private Integer outStockUserId;

    //仓库名称
    @TableField(exist = false)
    private String warehouseName;

    //仓库id
    @TableField(exist = false)
    private Integer warehouseId;

    /**
     * 距离
     */
    @TableField(exist = false)
    private Integer distance;

    public RecoveryLog(Integer accountId, Integer machineId, String userCode,
                       String machineNO, Date startTime, Double startLo, Double startLa,
                       Integer recoveryUserId, String recoveryUserName, Integer state) {
        this.accountId = accountId;
        this.machineId = machineId;
        this.userCode = userCode;
        this.machineNO = machineNO;
        this.startTime = startTime;
        this.startLo = startLo;
        this.startLa = startLa;
        this.recoveryUserId = recoveryUserId;
        this.recoveryUserName = recoveryUserName;
        this.state = state;
    }

}
